//
//  MyKuangJiVC.m
//  digitalCurrency
//
//  Created by 小震GG on 2019/10/31.
//  Copyright © 2019 XinHuoKeJi. All rights reserved.
//

#import "MyKuangJiVC.h"
#import "NewAllNetManager.h"
#import "CTHeaderView.h"
#import "HFFanClubJoinRollView.h"
#import "MyTeamVC.h"
#import "MineNetManager.h"
#import "MyHuanKuan.h"
@interface MyKuangJiVC ()
{
    UIImageView *bgImage;
}

@property (nonatomic, copy) NSString *activationStr; //是否激活
@property (nonatomic, strong) UILabel *canUseLB;
@property (nonatomic, strong) UILabel *typeLB;
@property (nonatomic, strong) UIButton *typeBtn;

@property (nonatomic, strong) CTHeaderView *headerView;

@property (nonatomic, strong) UIView *tBgView;
@property (nonatomic, strong) UIImageView *tBgImage;
@property (nonatomic, copy) NSString *tTypeStr;
@property (nonatomic, strong) UILabel *tNowBalanceLB;
@property (nonatomic, strong) UITextField *threeTF1;
@property (nonatomic, strong) UITextField *threeTF2;
@property (nonatomic, strong) UIButton *threeCodeBtn;
@property (nonatomic, strong) UILabel *threePayLB;

@property (nonatomic, strong) NSTimer *numberTimer;
@property (nonatomic, assign) NSInteger timeCount;
@end

@implementation MyKuangJiVC

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:NO];
}

- (void)viewDidDsappear:(BOOL)animated{
    [super viewDidDisappear:animated];
    
    [self.numberTimer invalidate];
    self.numberTimer = nil;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    self.view.backgroundColor = tBgQianColor;
    
    self.activationStr = @"2";
    self.tTypeStr = @"4";
    
    [self setView];
    
}

- (void)setView{
    UIView *topView = [[UIView alloc]init];
    [self.view addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.equalTo(0);
        make.height.equalTo(SafeAreaTopHeight);
    }];
    topView.backgroundColor = [UIColor whiteColor];
    
    UILabel *leftLB = [[UILabel alloc]init];
    [topView addSubview:leftLB];
    [leftLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(16);
        make.bottom.equalTo(-13);
    }];
    leftLB.textColor = tThreeColor;
    leftLB.font = kFontPF_Medium(20);
    leftLB.text = LocalizationKey(@"贷款");
    
    UIButton *rightLB = [[UIButton alloc]init];
       [topView addSubview:rightLB];
       [rightLB mas_makeConstraints:^(MASConstraintMaker *make) {
           make.right.equalTo(-16);
           make.centerY.equalTo(leftLB);
       }];
    [rightLB setTitle:LocalizationKey(@"我的团队") forState:UIControlStateNormal];
    [rightLB setTitleColor:tMainColor forState:UIControlStateNormal];
       rightLB.titleLabel.font = kFontPF_Medium(16);
    [rightLB addTarget:self action:@selector(rightLBAct) forControlEvents:UIControlEventTouchUpInside];
    
    bgImage = [[UIImageView alloc]init];
    [self.view addSubview:bgImage];
    [bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(12);
        make.top.equalTo(SafeAreaTopHeight+11);
        make.right.equalTo(-12);
        make.height.equalTo(234);
    }];
    bgImage.image = ImageName(@"d_head_bg");
    bgImage.userInteractionEnabled = YES;
    
    UILabel *titleLB = [[UILabel alloc]init];
    [bgImage addSubview:titleLB];
    [titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(0);
        make.top.equalTo(31);
    }];
    titleLB.textColor = [UIColor colorWithWhite:1 alpha:0.5];
    titleLB.font = kFont(16);
    titleLB.text = LocalizationKey(@"当前可用额度（USDT）");
    
    self.canUseLB = [[UILabel alloc]init];
    [bgImage addSubview:self.canUseLB];
    [self.canUseLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(0);
        make.top.equalTo(titleLB.mas_bottom).offset(20);
    }];
    self.canUseLB.textColor = [UIColor whiteColor];
    self.canUseLB.font = kFontPF_Bold(36);
    self.canUseLB.text = @"0";
    
    self.typeLB = [[UILabel alloc]init];
    [bgImage addSubview:self.typeLB];
    [self.typeLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(0);
        make.top.equalTo(titleLB.mas_bottom).offset(79);
    }];
    self.typeLB.textColor = [UIColor whiteColor];
    self.typeLB.font = kFont(14);
    
    self.typeBtn = [[UIButton alloc]init];
    [bgImage addSubview:self.typeBtn];
    [self.typeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(60);
        make.right.equalTo(-60);
        make.top.equalTo(175);
        make.height.equalTo(40);
    }];
    self.typeBtn.backgroundColor = [UIColor whiteColor];
    [self.typeBtn setTitleColor:tMainColor forState:UIControlStateNormal];
    self.typeBtn.titleLabel.font = kFontPF_Medium(16);
    self.typeBtn.layer.masksToBounds = YES;
    self.typeBtn.layer.cornerRadius = 20.0;
    [self.typeBtn addTarget:self action:@selector(typeBtnAct:) forControlEvents:UIControlEventTouchUpInside];
    
    self.headerView = [[CTHeaderView alloc]init];
    [self.view addSubview:self.headerView];
    [self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(0);
        make.top.equalTo(bgImage.mas_bottom);
        make.height.equalTo(69);
    }];
    self.headerView.backgroundColor = tBgQianColor;
    [self.headerView.rollView setNewArray:@[@"1234",@"2345"] rightArr:@[@"2018",@"2019"]];

    UIView *bottomView = [[UIView alloc]init];
    [self.view addSubview:bottomView];
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(16);
        make.right.equalTo(-16);
        make.top.equalTo(self.headerView.mas_bottom).offset(12);
        make.height.equalTo(174);
    }];
    bottomView.backgroundColor = [UIColor whiteColor];
    bottomView.layer.cornerRadius = 5.0;
    bottomView.layer.shadowColor = [UIColor colorWithHEX:@"#6E6E6E"].CGColor;
    bottomView.layer.shadowOffset = CGSizeMake(0, 0);
    bottomView.layer.shadowOpacity = 0.11;
    
    UILabel *bottomTLB = [[UILabel alloc]init];
    [bottomView addSubview:bottomTLB];
    [bottomTLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(16);
        make.top.equalTo(16);
    }];
    bottomTLB.font = kFont(19);
    bottomTLB.textColor = tThreeColor;
    bottomTLB.text = LocalizationKey(@"借币规则");
    
    UILabel *bottomCLB = [[UILabel alloc]init];
    [bottomView addSubview:bottomCLB];
    [bottomCLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(16);
        make.right.equalTo(-34);
        make.top.equalTo(56);
    }];
    bottomCLB.numberOfLines = 0;
    bottomCLB.textColor = tThreeColor;
    bottomCLB.font = kFont(14);
    bottomCLB.text = LocalizationKey(@"1.1 为了规范数字资产借币、杠杆交易行为。\n1.2 本规则所称的借币、杠杆交易。\n1.3 在OKEx.com进行的借币、杠杆交易，适用本规则。");
    
    
    if ([self.activationStr isEqualToString:@"1"]) {
        [bgImage mas_remakeConstraints:^(MASConstraintMaker *make) {
               make.left.equalTo(12);
               make.top.equalTo(SafeAreaTopHeight+11);
               make.right.equalTo(-12);
               make.height.equalTo(234);
        }];
        self.typeLB.text = LocalizationKey(@"信用状态：未激活");
        [self.typeBtn setTitle:LocalizationKey(@"激活信用额度") forState:UIControlStateNormal];
        self.typeBtn.tag = 100+1;
    }
    else{
        [bgImage mas_remakeConstraints:^(MASConstraintMaker *make) {
               make.left.equalTo(12);
               make.top.equalTo(SafeAreaTopHeight+11);
               make.right.equalTo(-12);
               make.height.equalTo(234+66);
        }];
        self.typeLB.text = LocalizationKey(@"信用状态：良好");
        [self.typeBtn setTitle:LocalizationKey(@"立即借币") forState:UIControlStateNormal];
        self.typeBtn.tag = 100+2;
        
        UIView *lineHengView = [[UIView alloc]init];
        [bgImage addSubview:lineHengView];
        [lineHengView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(0);
            make.bottom.equalTo(-65);
            make.height.equalTo(1);
        }];
        lineHengView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.3];
        
        UIView *lineShuView = [[UIView alloc]init];
        [bgImage addSubview:lineShuView];
        [lineShuView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(0);
            make.bottom.equalTo(-24);
            make.width.equalTo(1);
            make.height.equalTo(21);
        }];
        lineShuView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.3];
        
        SYButton *huanKuanBtn = [[SYButton alloc]init];
        [bgImage addSubview:huanKuanBtn];
        [huanKuanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.bottom.equalTo(0);
            make.height.equalTo(65);
            make.right.equalTo(lineShuView.mas_left);
        }];
        [huanKuanBtn setImage:ImageName(@"j_huankuan") forState:UIControlStateNormal];
        [huanKuanBtn setTitle:LocalizationKey(@"我要还款") forState:UIControlStateNormal];
        [huanKuanBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        huanKuanBtn.titleLabel.font = kFont(16);
        huanKuanBtn.btnType = LEFT;
        [huanKuanBtn addTarget:self action:@selector(huanKuanBtnAct) forControlEvents:UIControlEventTouchUpInside];
        
        SYButton *jieKuanBtn = [[SYButton alloc]init];
        [bgImage addSubview:jieKuanBtn];
        [jieKuanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.bottom.equalTo(0);
            make.height.equalTo(65);
            make.left.equalTo(lineShuView.mas_right);
        }];
        [jieKuanBtn setImage:ImageName(@"j_jiekuan") forState:UIControlStateNormal];
        [jieKuanBtn setTitle:LocalizationKey(@"借款记录") forState:UIControlStateNormal];
        [jieKuanBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        jieKuanBtn.titleLabel.font = kFont(16);
        jieKuanBtn.btnType = LEFT;
        [jieKuanBtn addTarget:self action:@selector(jieKuanBtnAct) forControlEvents:UIControlEventTouchUpInside];
    }
    
    
}

#pragma 还款
- (void)huanKuanBtnAct{
    MyHuanKuan *VC = [[MyHuanKuan alloc]init];
    VC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:VC animated:YES];
}

#pragma 借款
- (void)jieKuanBtnAct{
    
}

- (void)rightLBAct{
    MyTeamVC *VC = [[MyTeamVC alloc]init];
    VC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:VC animated:YES];
}

#pragma 激活/借币Btn
- (void)typeBtnAct:(UIButton *)sender{
    if (sender.tag == 101) {
        //激活
        [self setTanKuangView];
    }
    else{
        //借币
        
    }
}

- (void)setTanKuangView{
    self.tBgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kWindowW, kWindowH)];
    [APPLICATION.window addSubview:self.tBgView];
    self.tBgView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];
    
    self.tBgImage = [[UIImageView alloc]init];
    [self.tBgView addSubview:self.tBgImage];
    [self.tBgImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(0);
        make.left.equalTo(32);
        make.right.equalTo(-32);
        make.height.equalTo(414);
    }];
    self.tBgImage.image = ImageName(@"tanKuang_bg");
    self.tBgImage.userInteractionEnabled = YES;
    
    UIButton *chaBtn = [[UIButton alloc]init];
    [self.tBgImage addSubview:chaBtn];
    [chaBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(-10);
        make.top.equalTo(10);
        make.width.height.equalTo(40);
    }];
    [chaBtn setImage:ImageName(@"tanKuang_cha") forState:UIControlStateNormal];
    [chaBtn addTarget:self action:@selector(chaBtnAct) forControlEvents:UIControlEventTouchUpInside];
    
    
    if ([self.tTypeStr isEqualToString:@"1"]) {
        [self setTKOneView];
    }
    else if ([self.tTypeStr isEqualToString:@"2"]) {
        [self setTKTwoView];
    }
    else if ([self.tTypeStr isEqualToString:@"3"]) {
        [self setTKThreeView];
    }
    else if ([self.tTypeStr isEqualToString:@"4"]) {
        [self setTKFourView];
    }
}

#pragma 弹框一
- (void)setTKOneView{
    UILabel *contentLB = [[UILabel alloc]init];
    [self.tBgImage addSubview:contentLB];
    [contentLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(42);
        make.right.equalTo(-42);
        make.top.equalTo(103);
    }];
    contentLB.numberOfLines = 0;
    contentLB.font = kFont(16);
    contentLB.textColor = [UIColor whiteColor];
    contentLB.text = LocalizationKey(@"当前账号额度未激活，加入会员后，即可激活借款服务。\n\n\n加入会员，需支付100USDT手续费。后台审核入会。");
    
    UIButton *okBtn = [[UIButton alloc]init];
    [self.tBgImage addSubview:okBtn];
    [okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(35);
        make.right.equalTo(-35);
        make.height.equalTo(48);
        make.bottom.equalTo(-35);
        
    }];
    okBtn.backgroundColor = tMainColor;
    [okBtn setTitle:LocalizationKey(@"立即激活") forState:UIControlStateNormal];
    [okBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    okBtn.titleLabel.font = kFont(19);
    okBtn.tag = 1000+1;
    okBtn.layer.cornerRadius = 24.0;
    [okBtn addTarget:self action:@selector(okBtnAct:) forControlEvents:UIControlEventTouchUpInside];
    
}

#pragma 弹框二
- (void)setTKTwoView{
    
    self.tNowBalanceLB = [[UILabel alloc]init];
    [self.tBgImage addSubview:self.tNowBalanceLB];
    [self.tNowBalanceLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(83);
        make.centerX.equalTo(0);
    }];
    self.tNowBalanceLB.textColor = [UIColor whiteColor];
    self.tNowBalanceLB.font = kFontPF_Medium(19);
    self.tNowBalanceLB.text = [NSString stringWithFormat:@"%@0",LocalizationKey(@"当前账户余额：")];
    
    UILabel *contentLB = [[UILabel alloc]init];
    [self.tBgImage addSubview:contentLB];
    [contentLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(42);
        make.right.equalTo(-42);
        make.top.equalTo(142);
    }];
    contentLB.numberOfLines = 0;
    contentLB.font = kFont(16);
    contentLB.textColor = [UIColor colorWithWhite:1 alpha:0.8];
    contentLB.text = LocalizationKey(@"当前账户余额不足，无法继续，请充值后重新操作，入会流程。\n\n\n感谢您的配合！");
    
    UIButton *okBtn = [[UIButton alloc]init];
    [self.tBgImage addSubview:okBtn];
    [okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(35);
        make.right.equalTo(-35);
        make.height.equalTo(48);
        make.bottom.equalTo(-35);
        
    }];
    okBtn.backgroundColor = tMainColor;
    [okBtn setTitle:LocalizationKey(@"立即充值") forState:UIControlStateNormal];
    [okBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    okBtn.titleLabel.font = kFont(19);
    okBtn.tag = 1000+2;
    okBtn.layer.cornerRadius = 24.0;
    [okBtn addTarget:self action:@selector(okBtnAct:) forControlEvents:UIControlEventTouchUpInside];
}

#pragma 弹框三
- (void)setTKThreeView{
    
    self.tNowBalanceLB = [[UILabel alloc]init];
    [self.tBgImage addSubview:self.tNowBalanceLB];
    [self.tNowBalanceLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(83);
        make.centerX.equalTo(0);
    }];
    self.tNowBalanceLB.textColor = [UIColor whiteColor];
    self.tNowBalanceLB.font = kFontPF_Medium(19);
    self.tNowBalanceLB.text = [NSString stringWithFormat:@"%@0",LocalizationKey(@"当前账户余额：")];
    
    UIView *TFView1 = [[UIView alloc]init];
    [self.tBgImage addSubview:TFView1];
    [TFView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(20);
        make.top.equalTo(134);
        make.width.equalTo(145);
        make.height.equalTo(35);
    }];
    TFView1.backgroundColor = [UIColor colorWithWhite:1 alpha:0.2];
    TFView1.layer.masksToBounds = YES;
    TFView1.layer.cornerRadius = 35.0/2.0;
    
    self.threeTF1 = [[UITextField alloc]init];
    [TFView1 addSubview:self.threeTF1];
    [self.threeTF1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(20);
        make.right.equalTo(-20);
        make.centerY.equalTo(0);
        make.height.equalTo(35);
    }];
    self.threeTF1.textColor = [UIColor whiteColor];
    self.threeTF1.placeholder = LocalizationKey(@"请输入验证码");
    self.threeTF1.font = kFont(14);
    NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:LocalizationKey(@"请输入验证码") attributes:@{NSForegroundColorAttributeName:[UIColor colorWithWhite:1 alpha:0.5],NSFontAttributeName:self.threeTF1.font}];
    self.threeTF1.attributedPlaceholder = attrString;
    
    self.threeCodeBtn = [[UIButton alloc]init];
    [self.tBgImage addSubview:self.threeCodeBtn];
    [self.threeCodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(-20);
        make.top.equalTo(134);
        make.width.equalTo(112);
        make.height.equalTo(35);
    }];
    self.threeCodeBtn.backgroundColor = [UIColor colorWithWhite:1 alpha:0.4];
    self.threeCodeBtn.layer.masksToBounds = YES;
    self.threeCodeBtn.layer.cornerRadius = 35.0/2.0;
    [self.threeCodeBtn setTitle:LocalizationKey(@"短信验证码") forState:UIControlStateNormal];
    [self.threeCodeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.threeCodeBtn.titleLabel.font = kFont(14);
    [self.threeCodeBtn addTarget:self action:@selector(threeCodeBtnAct) forControlEvents:UIControlEventTouchUpInside];
    
    UIView *TFView2 = [[UIView alloc]init];
    [self.tBgImage addSubview:TFView2];
    [TFView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(20);
        make.right.equalTo(-20);
        make.top.equalTo(TFView1.mas_bottom).offset(12);
        make.height.equalTo(35);
    }];
    TFView2.backgroundColor = [UIColor colorWithWhite:1 alpha:0.2];
    TFView2.layer.masksToBounds = YES;
    TFView2.layer.cornerRadius = 35.0/2.0;
    
    self.threeTF2 = [[UITextField alloc]init];
    [TFView2 addSubview:self.threeTF2];
    [self.threeTF2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(20);
        make.right.equalTo(-20);
        make.centerY.equalTo(0);
        make.height.equalTo(35);
    }];
    self.threeTF2.textColor = [UIColor whiteColor];
    self.threeTF2.placeholder = LocalizationKey(@"请输入资金支付密码");
    self.threeTF2.font = kFont(14);
    self.threeTF2.secureTextEntry = YES;
    NSAttributedString *attrString1 = [[NSAttributedString alloc] initWithString:LocalizationKey(@"请输入资金支付密码") attributes:@{NSForegroundColorAttributeName:[UIColor colorWithWhite:1 alpha:0.5],NSFontAttributeName:self.threeTF2.font}];
    self.threeTF2.attributedPlaceholder = attrString1;
    
    self.threePayLB = [[UILabel alloc]init];
    [self.tBgImage addSubview:self.threePayLB];
    [self.threePayLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(0);
        make.top.equalTo(TFView2.mas_bottom).offset(20);
    }];
    self.threePayLB.textColor = [UIColor colorWithWhite:1 alpha:0.5];
    self.threePayLB.font = kFont(14);
    self.threePayLB.text = [NSString stringWithFormat:@"%@100USDT",LocalizationKey(@"支付")];
    
    UIButton *okBtn = [[UIButton alloc]init];
    [self.tBgImage addSubview:okBtn];
    [okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(35);
        make.right.equalTo(-35);
        make.height.equalTo(48);
        make.bottom.equalTo(-35);
        
    }];
    okBtn.backgroundColor = tMainColor;
    [okBtn setTitle:LocalizationKey(@"立即激活") forState:UIControlStateNormal];
    [okBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    okBtn.titleLabel.font = kFont(19);
    okBtn.tag = 1000+3;
    okBtn.layer.cornerRadius = 24.0;
    [okBtn addTarget:self action:@selector(okBtnAct:) forControlEvents:UIControlEventTouchUpInside];
    
}

#pragma 弹框四
- (void)setTKFourView{
    
    UIView *TFView1 = [[UIView alloc]init];
    [self.tBgImage addSubview:TFView1];
    [TFView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(20);
        make.top.equalTo(114);
        make.width.equalTo(145);
        make.height.equalTo(35);
    }];
    TFView1.backgroundColor = [UIColor colorWithWhite:1 alpha:0.2];
    TFView1.layer.masksToBounds = YES;
    TFView1.layer.cornerRadius = 35.0/2.0;
    
    self.threeTF1 = [[UITextField alloc]init];
    [TFView1 addSubview:self.threeTF1];
    [self.threeTF1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(20);
        make.right.equalTo(-20);
        make.centerY.equalTo(0);
        make.height.equalTo(35);
    }];
    self.threeTF1.textColor = [UIColor whiteColor];
    self.threeTF1.placeholder = LocalizationKey(@"请输入验证码");
    self.threeTF1.font = kFont(14);
    NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:LocalizationKey(@"请输入验证码") attributes:@{NSForegroundColorAttributeName:[UIColor colorWithWhite:1 alpha:0.5],NSFontAttributeName:self.threeTF1.font}];
    self.threeTF1.attributedPlaceholder = attrString;
    
    self.threeCodeBtn = [[UIButton alloc]init];
    [self.tBgImage addSubview:self.threeCodeBtn];
    [self.threeCodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(-20);
        make.top.equalTo(114);
        make.width.equalTo(112);
        make.height.equalTo(35);
    }];
    self.threeCodeBtn.backgroundColor = [UIColor colorWithWhite:1 alpha:0.4];
    self.threeCodeBtn.layer.masksToBounds = YES;
    self.threeCodeBtn.layer.cornerRadius = 35.0/2.0;
    [self.threeCodeBtn setTitle:LocalizationKey(@"短信验证码") forState:UIControlStateNormal];
    [self.threeCodeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    self.threeCodeBtn.titleLabel.font = kFont(14);
    [self.threeCodeBtn addTarget:self action:@selector(threeCodeBtnAct) forControlEvents:UIControlEventTouchUpInside];
    
    UIView *TFView2 = [[UIView alloc]init];
    [self.tBgImage addSubview:TFView2];
    [TFView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(20);
        make.right.equalTo(-20);
        make.top.equalTo(TFView1.mas_bottom).offset(12);
        make.height.equalTo(35);
    }];
    TFView2.backgroundColor = [UIColor colorWithWhite:1 alpha:0.2];
    TFView2.layer.masksToBounds = YES;
    TFView2.layer.cornerRadius = 35.0/2.0;
    
    self.threeTF2 = [[UITextField alloc]init];
    [TFView2 addSubview:self.threeTF2];
    [self.threeTF2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(20);
        make.right.equalTo(-20);
        make.centerY.equalTo(0);
        make.height.equalTo(35);
    }];
    self.threeTF2.textColor = [UIColor whiteColor];
    self.threeTF2.placeholder = LocalizationKey(@"请输入资金支付密码");
    self.threeTF2.font = kFont(14);
    self.threeTF2.secureTextEntry = YES;
    NSAttributedString *attrString1 = [[NSAttributedString alloc] initWithString:LocalizationKey(@"请输入资金支付密码") attributes:@{NSForegroundColorAttributeName:[UIColor colorWithWhite:1 alpha:0.5],NSFontAttributeName:self.threeTF2.font}];
    self.threeTF2.attributedPlaceholder = attrString1;
    
    UIButton *okBtn = [[UIButton alloc]init];
    [self.tBgImage addSubview:okBtn];
    [okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(35);
        make.right.equalTo(-35);
        make.height.equalTo(48);
        make.bottom.equalTo(-35);
        
    }];
    okBtn.backgroundColor = tMainColor;
    [okBtn setTitle:LocalizationKey(@"立即支付") forState:UIControlStateNormal];
    [okBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    okBtn.titleLabel.font = kFont(19);
    okBtn.tag = 1000+4;
    okBtn.layer.cornerRadius = 24.0;
    [okBtn addTarget:self action:@selector(okBtnAct:) forControlEvents:UIControlEventTouchUpInside];
    
}

- (void)okBtnAct:(UIButton *)sender{
    
    if (sender.tag == 1001)
    {
        
    }
    else if (sender.tag == 10002)
    {
        
        
    }
    else if (sender.tag == 10003)
    {
        
        
    }
    else if (sender.tag == 10004)
    {
        
        
    }
}

- (void)threeCodeBtnAct{
    self.timeCount = 60;
    self.numberTimer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(numberTimerAct) userInfo:nil repeats:YES];
    [[NSRunLoop currentRunLoop] addTimer:self.numberTimer forMode:NSDefaultRunLoopMode];
    self.threeCodeBtn.userInteractionEnabled = NO;
        
//    [self getphonncode];
}

- (void)numberTimerAct{
    
    if (self.timeCount == 1) {
        [self.numberTimer invalidate];
        self.numberTimer = nil;
        
        [self.threeCodeBtn setTitle:LocalizationKey(@"短信验证码") forState:UIControlStateNormal];
        self.threeCodeBtn.userInteractionEnabled = YES;
        return;
    }
    
    self.timeCount -- ;
    [self.threeCodeBtn setTitle:[NSString stringWithFormat:@"%.2lds",self.timeCount] forState:UIControlStateNormal];
}

//获取手机验证码
-(void)getphonncode {
     [MineNetManager resetMoneyPasswordCodeForCompleteHandle:^(id resPonseObj, int code) {
           [EasyShowLodingView hidenLoding];
           NSInteger codeint = [resPonseObj[@"code"] integerValue];
           if (code) {
               if (codeint == 0) {
               }
           }
     }];
}


- (void)chaBtnAct{
    self.tBgView.hidden = YES;
    self.tBgView = nil;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
